<?php

use App\Http\Controllers\Cashbook\Merchant\CashbookController;
use App\Http\Controllers\Common\CommonController;
use App\Http\Controllers\OpenShop\Feishu\AppletLoginController;
use App\Http\Controllers\OpenShop\Feishu\ConfigController;
use App\Http\Controllers\OpenShop\Feishu\ContractTemplateController;
use App\Http\Controllers\OpenShop\Feishu\CustomerDepartmentController;
use App\Http\Controllers\OpenShop\Feishu\DesignerEquipmentController;
use App\Http\Controllers\OpenShop\Feishu\KfosController;
use App\Http\Controllers\OpenShop\Feishu\OrganizationManageController;
use App\Http\Controllers\OpenShop\Feishu\RmsUserController;
use App\Http\Controllers\OpenShop\Feishu\SelectionController;
use App\Http\Controllers\OpenShop\Feishu\ShopCheckAcceptController;
use App\Http\Controllers\OpenShop\Feishu\ShopEngineeringConstructionController;
use App\Http\Controllers\OpenShop\Feishu\SignOrderController;
use App\Http\Controllers\OpenShop\Feishu\SignOrderManualController;
use App\Http\Controllers\OpenShop\Feishu\SpaceDesignController;
use App\Http\Controllers\OpenShop\Feishu\SystemNoticeController;
use App\Http\Controllers\OpenShop\Feishu\StartBusinessController;
use App\Http\Controllers\OpenShop\Feishu\UserBaseInfoController;
use App\Http\Controllers\OpenShop\Feishu\UserContractController;
use App\Http\Controllers\OpenShop\FeishuMini\ConsultantsController;
use App\Http\Controllers\OpenShop\FeishuMini\ProgrammingController;
use App\Http\Controllers\OpenShop\FeishuMini\SandTableController;
use App\Http\Controllers\OpenShop\Merchant\AppController;
use App\Http\Controllers\OpenShop\Merchant\ExpireShopController;
use App\Http\Controllers\OpenShop\Merchant\ExpressController;
use App\Http\Controllers\OpenShop\Organization\WarZoneController;
use App\Http\Controllers\OpenShop\SiteLocation\DevelopmentManagerController;
use App\Http\Controllers\OpenShop\SiteLocation\IntendedSiteSelectionController;
use App\Http\Controllers\OpenShop\SiteLocation\KpPartyController;
use App\Http\Controllers\OpenShop\SiteLocation\PlaceholderController;
use App\Http\Controllers\OpenShop\SiteLocation\SiteFormController;
use App\Http\Controllers\OpenShop\SiteLocation\SiteTaskController;
use App\Http\Controllers\OpenShop\SiteLocation\UserController;
use App\Http\Controllers\OpenShop\SiteLocation\WeatherController;
use App\Http\Controllers\OpenShop\SiteLocation\WhiteListController;
use App\Http\Controllers\Schedule\Merchant\ScheduleController;
use App\Http\Middleware\OpenShop\AppletAuth;
use App\Http\Middleware\OpenShop\FeishuWebAuth;
use App\Http\Middleware\OpenShop\UserPermissionAuth;
use App\Http\Middleware\OpenShop\WangGuiCityByPower;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\OpenShop\Feishu\FeishuController;
use App\Http\Controllers\OpenShop\Feishu\LoginController;
use App\Http\Controllers\OpenShop\Wap\SignOrderController as WapSignOrderController;
use App\Http\Controllers\OpenShop\Pay\PayController;
use App\Http\Controllers\OpenShop\Merchant\OrderController as MerchantOrderController;
use App\Http\Middleware\OpenShop\MerchantAppAuth;
use App\Http\Controllers\OpenShop\Feishu\SiteMissionController;
use App\Http\Controllers\OpenShop\Feishu\MissionTemplateController;
use App\Http\Controllers\OpenShop\FeishuMini\MissionController;
use App\Http\Controllers\OpenShop\FeishuMini\ShopController;
use App\Http\Controllers\OpenShop\FeishuMini\IndexController;
use App\Http\Controllers\OpenShop\Notify\SystemNotifyController;
use App\Http\Controllers\OpenShop\SiteLocation\SiteEvaluateInputController;
use App\Http\Controllers\Schedule\Merchant\ScheduleHandleController;
use App\Http\Middleware\MerchantManager;
use App\Http\Middleware\Common\LockBefore;
use App\Http\Middleware\Common\LockAfter;

Route::any('fakeOrder', [\App\Http\Controllers\OpenShop\Fake\FakeController::class, 'fakeOrder']);
Route::any('createRenewOrder', [\App\Http\Controllers\OpenShop\Fake\FakeController::class, 'createRenewOrder']);
Route::get('newSignDaily', function () { return view('openShop.newSignDaily.index'); });
Route::post('newSignDaily', [\App\Http\Controllers\OpenShop\Fake\FakeController::class, 'sendDaily']);
Route::post('updateNewSignDaily', [\App\Http\Controllers\OpenShop\Fake\FakeController::class, 'updateNewSignDaily']);
Route::any('manual/{orderNo}/{shopCode}', function ($orderNo, $shopCode) {
    (new \App\Service\OpenShop\Feishu\ShopManualService($orderNo))->make($shopCode);
    echo 'success';
});
// 全国+省区机器人推送
Route::get('provincialRobotNotice', function () { return view('openShop.provincialRobotNotice.index'); });
Route::post('provincialRobotNotice', [\App\Http\Controllers\OpenShop\Fake\FakeController::class, 'provincialRobotNotice']);

/**
 * 夸父开店功能路由
 */

// Wap
Route::group(['prefix' => 'wap'], function () {

    // 签约订单
    Route::group(['prefix' => 'signOrder'], function () {
        Route::get('payDetail/{secretOrderNo}', [WapSignOrderController::class, 'payDetail']);
        Route::get('getShop/{orderNo}', [WapSignOrderController::class, 'getShop']);
    });

});

// 通用
Route::group(['prefix' => 'common'], function () {

    // 节假日查询
    Route::get('holiday', [CommonController::class, 'holiday']);
});

// Pay
Route::group(['prefix' => 'pay'], function () {

    // wap支付
    Route::post('wapPay', [PayController::class, 'wapPay']);

    // app支付
    Route::post('appPay', [PayController::class, 'appPay'])->middleware(MerchantAppAuth::class);

    // 支付状态查询
    Route::get('payStatus/{secretOrderNo}', [PayController::class, 'payStatus']);
    Route::get('payStatusCommon', [PayController::class, 'payStatusCommon']);
});

Route::prefix('feishu')->namespace('Feishu')->group(function () {
    Route::get('getAppAccessToken', [FeishuController::class, 'getAppAccessToken']);
    Route::get('getTenantAccToken', [FeishuController::class, 'getTenantAccToken']); // 废弃
    Route::get('getTicket', [FeishuController::class, 'getTicket']); // 废弃
    Route::post('login', [LoginController::class, 'login']);

    /**
     * 飞书PC网页认证路由组
     */
    Route::middleware([FeishuWebAuth::class, UserPermissionAuth::class])->group(function () {

        /**
         * 公共部分
         */
        Route::group(["prefix" => "common"], function () {
            Route::post("privateUpload", [CommonController::class, "privateUpload"])->withoutMiddleware([FeishuWebAuth::class, UserPermissionAuth::class]);
        });

        /**
         * 配置信息
         */
        Route::group(["prefix" => "config"], function () {
            Route::get("", [ConfigController::class, "configInfo"]);
//            Route::get("", [\App\Http\Controllers\Common\ConfigController::class, "config"]);
        });

        /**
         * 用户基础信息
         */
        Route::group(["prefix" => "userBaseInfo"], function () {
            Route::post("/identityCardRecognize", [UserBaseInfoController::class, "identityCardRecognize"]);
            Route::post("/publicIdentityCardRecognize", [UserBaseInfoController::class, "publicIdentityCardRecognize"]);
            Route::post("/businessLicenseRecognize", [UserBaseInfoController::class, "businessLicenseRecognize"]);
            Route::post("", [UserBaseInfoController::class, "insert"]);
            Route::post("/{orderNo}", [UserBaseInfoController::class, "update"]);
            Route::get("/{orderNo}", [UserBaseInfoController::class, "detail"]);
            Route::post("/paidOrderUpdate/{orderNo}", [UserBaseInfoController::class, "paidOrderBaseInfoUpdate"]);
        });

        /**
         * 合同
         */
        Route::group(["prefix" => "contract"], function () {
            Route::get("/templateList", [UserContractController::class, "templateList"]);
            Route::post("", [UserContractController::class, "insert"]);
            Route::post("/{orderNo}", [UserContractController::class, "update"]);
            Route::get("/{orderNo}", [UserContractController::class, "detail"]);
            Route::post("/handleExceptionMsg/{orderNo}", [UserContractController::class, "handleExceptionMsg"]);
            Route::post("/generateUserContract/{orderNo}", [UserContractController::class, "generateUserContract"]);

            Route::get("/invalid/{orderNo}", [UserContractController::class, "invalidContract"]);//作废合同

        });

        /**
         * 加盟政策(合同模版)
         */
        Route::group(["prefix" => "contractTemplate"], function () {
            Route::get("/list", [ContractTemplateController::class, "dataList"]);
            Route::get("/info/{id}", [ContractTemplateController::class, "info"]);
            Route::post("/updateShow/{id}", [ContractTemplateController::class, "updateShow"]);
            Route::post("/getInstancesInfo", [ContractTemplateController::class, "getInstancesInfo"]);
        });


        /**
         * 签约订单
         */
        Route::group(["prefix" => "order"], function () {
            //筹备订单
            Route::get('/preparationOverview', [SignOrderController::class, 'preparationOverview']);
            Route::get('/preparationList', [SignOrderController::class, 'preparationList']);
            Route::get('/preparationLog/{orderNo}', [SignOrderController::class, 'preparationLog']);//筹备订单日志
            Route::put('/preparationUpdate/{orderNo}', [SignOrderController::class, 'preparationUpdate']);//筹备订单修改

            Route::get('/overview', [SignOrderController::class, 'overview']);
            Route::get('/list', [SignOrderController::class, 'index']);
            //Route::get('/diff', [SignOrderController::class, 'diff']);
            Route::get('/template', [SignOrderController::class, 'orderFilterTemplate']);
            Route::get('/queryAvailableFlows', [SignOrderController::class, 'queryAvailableFlows']); // 查询可用于线下支付的银行流水
            Route::get("/{orderNo}", [SignOrderController::class, "detail"]);
            Route::post("/invalidOrder/{orderNo}", [SignOrderController::class, "invalidOrder"]);
            Route::get("/payHistory/{orderNo}", [SignOrderController::class, 'orderPayHistory']);
            Route::post('/createContract/{orderNo}', [SignOrderController::class, 'createContract']);
            Route::post('/submitOrderProof/{orderNo}', [SignOrderController::class, 'submitOrderProof']);
            Route::put('/changeManager/{id}', [SignOrderController::class, 'changeManager']);
            Route::get('/getOrderCityFee/{orderNo}', [SignOrderController::class, 'getOrderCityFee']);

            // 刷新手册
            Route::post("/refreshManual/{orderNo}", [SignOrderManualController::class, "refreshManual"]);
            Route::get("/invalidOrderType/{orderNo}", [SignOrderController::class, "invalidOrderType"]);

            //延期门店
            Route::post("/deferOrder", [SignOrderController::class, "deferOrder"]);
        });



        Route::get('/openShop/diff', [SignOrderController::class, 'diff']);

        /**
         * 选址开发
         */
        Route::group(["prefix" => "selection"], function () {
            //开发经理列表
            Route::get('/manager/list', [SelectionController::class, 'index']);
            Route::get('/siteTaskHandler/list', [SelectionController::class, 'getSiteTaskHandlerList']);
            Route::post('/manager/add', [SelectionController::class, 'addManager']);  //添加开发经理
            Route::post('/report/add', [SelectionController::class, 'addReport']);    //添加开发选址表单
            Route::put('/reportWithPower/{orderNo}',
                [SelectionController::class, 'setReportWithPower']);    //编辑开发选址表单 带有权限
            Route::get('/report/info', [SelectionController::class, 'getReportInfo']);    //解析开发选址表单
            Route::post('/disclosure/add', [SelectionController::class, 'saveDisclosure']);    //上传信息披露文件
            Route::get('/baseHouseInfoByLatAndLng', [SiteFormController::class, 'baseHouseInfoByLatAndLng']);

            /**
             * 重新选址
             */
            Route::post('/reSelection/{orderNo}', [SelectionController::class, 'reSelection']);

            /**
             * 预选址更新
             */
            Route::put('/placeholder/{orderNo}', [PlaceholderController::class, 'save']);

            /**
             * 选址网规地图
             */
            Route::get("mapLists", [SelectionController::class, "mapLists"]);//全国视图列表
            Route::get("mapRank", [SelectionController::class, "mapRank"]);//全国视图排行榜
            Route::get("mapRange", [SelectionController::class, "mapRange"]);//全国省市区范围经纬度
            Route::get("mapShopList", [SelectionController::class, "mapShopList"]);//区域内店铺-列表
            Route::get("mapDetail/{shopId}", [SelectionController::class, "mapDetail"])
                 ->where('shopId', '[0-9]+');//单个店铺点位详细
            Route::get("mapDataList", [SelectionController::class, "mapDataList"]);//城市内数据集列表
            Route::get("mapRecommend", [SelectionController::class, "mapRecommend"]);//通过城市查询推荐区域


            /**
             * PC沙盘网规
             */

            // 全国网规点位统计
            Route::get('pointStatistics', [SelectionController::class, "pointStatistics"]);

            // 市维度点位信息
            Route::get('pc/point', [SelectionController::class, "pointByPc"]);
            // 竞品互补品接口
            Route::get('product/type', [SelectionController::class, "productType"]);
            //渗透数据展示
            Route::get('penetrationByCity', [SelectionController::class, "penetrationByCity"]);

            // 各个区的点位信息汇总
            Route::get('pointGatherByDistrict', [SelectionController::class, "pointGatherByDistrict"]);

            // 大卡片展示
            Route::get('floatCard', [SelectionController::class, "floatCard"]);
            // 根据shopCode获得营业趋势
            Route::get('businessTrend', [SelectionController::class, "businessTrend"]);
            // 列表头展示
            Route::get('pc/listHead', [SelectionController::class, "listHeadByPc"]);
            // 列表展示
            Route::get('pc/list', [SelectionController::class, "listByPc"]);

            // 周边
            Route::get('pc/nearby', [SelectionController::class, "nearbyByPc"]);

            // 热力图
            Route::get('pc/heatMap', [SelectionController::class, 'heatMapByPc']);

            /**
             * 选址3.1
             */
            // pc端商圈边界
            Route::get('getBusinessBoundaryByCityCode', [SelectionController::class, 'getBusinessBoundaryByCityCodeByPc']);
            // 商圈详情
            Route::get('businessCircleDetail/{id}', [SelectionController::class, 'businessCircleDetail'])->where('id', '[0-9]+');
            // 加盟商用户列表
            Route::get('franchisee/list', [SelectionController::class, 'franchiseeList']);
            // 商圈添加记录
            Route::post('businessCircle/addRecord/{id}', [SelectionController::class, 'addRecordToBusinessCircle'])->where('id', '[0-9]+');
            // 商圈添加预占加盟商
            Route::post('businessCircle/addPreOccupy/{id}', [SelectionController::class, 'addPreOccupyToBusinessCircle'])->where('id', '[0-9]+');
            // 删除记录接口
            Route::post('businessCircle/deleteRecord/{id}', [SelectionController::class, 'deleteRecordToBusinessCircle'])->where('id', '[0-9]+');




            Route::post("import/street", [ProgrammingController::class, "importStreet"]);//导入街道网规


            // 预测数据列表
            Route::get('getPredictionByWgNumber', [SelectionController::class, 'getPredictionByWgNumber']);
            Route::get('getHistoricalPredictionByWgNumber', [SelectionController::class, 'getHistoricalPredictionByWgNumber']);
            // 根据戳点获得Mercator预测值
            Route::get('getPredictionByCoordinate', [SelectionController::class, 'getPredictionByCoordinate']);
        });

        /**
         * 选址白名单配置
         */
        // 白名单列表
        Route::get('whiteList/list', [WhiteListController::class, 'list']);
        // 添加&修改
        Route::post('whiteList/save', [WhiteListController::class, 'save']);
        // 更新状态
        Route::post('whiteList/updateStatus', [WhiteListController::class, 'updateStatus']);

        /**
         * 堪址任务
         */
        Route::prefix('task')->group(function () {
            // 数据总览
            Route::get('overview', [SiteTaskController::class, 'overview']);
            // 清单
            Route::get('list', [SiteTaskController::class, 'list']);
            // 任务详情
            Route::get('detail/{id}', [SiteTaskController::class, 'detail'])->where('id', '[0-9]+');
            // 指派开发经理
            Route::post('assign', [SiteTaskController::class, 'assign']);

        });

        /**
         * 开发经理管理
         */
        Route::prefix('manager')->group(function () {
            // 数据总览
            Route::get('overview', [DevelopmentManagerController::class, 'overview']);
            // 列表
            Route::get('list', [DevelopmentManagerController::class, 'list']);
            // 基础详情
            Route::get('baseDetail/{userId}', [DevelopmentManagerController::class, 'baseDetail'])->where('userId', '[0-9]+');
            // 基础详情
            Route::get('taskDetail/{userId}', [DevelopmentManagerController::class, 'taskDetail'])->where('userId', '[0-9]+');
            // 开发经理涉及的城市
            Route::get('involve/{userId}', [DevelopmentManagerController::class, 'involve'])->where('userId', '[0-9]+');
            // 区域筛选
            Route::get('regionClassify', [DevelopmentManagerController::class, 'regionClassify']);



        });

        /**
         * 客情维护
         */
        Route::prefix('kpParty')->group(function () {
            // 数据总览
            Route::get('overview', [KpPartyController::class, 'overview']);
            // 列表
            Route::get('list', [KpPartyController::class, 'list']);
            // 关联项目
            Route::get('relationProject', [KpPartyController::class, 'relationProject']);
        });

        Route::prefix('sandTable/web/')->middleware(WangguiCityByPower::class . ':web')->group(function () {
            Route::get('cityListByPower', [ProgrammingController::class, "cityListByPower"]);
            Route::get('getCityByLngAndLat',
                [\App\Http\Controllers\OpenShop\FeishuMini\CommonController::class, "getCityByLngAndLat"]);  //根据经纬度获得城市
            Route::get('sift', [ProgrammingController::class, "sift"]);                                       //筛选条件
            Route::get('getProgrammingDotByCity',
                [SandTableController::class, "getProgrammingDotByCity"]); //获得市下面所有的网规点位信息
            Route::get('getDotDetail', [SandTableController::class, "getDotDetail"]);                       //获取点位详情
            Route::get('getDotCardInfo', [SandTableController::class, "getDotCardInfo"]);                   //获取点位卡片
            Route::get('dotSearch', [SandTableController::class, "dotSearch"]);                             //搜索点位
        });

        /**
         * 选址任务
         */
        Route::group(["prefix" => "siteMission"], function () {
            // 指派开发经理详情页面
            Route::get('/info/{id}', [SiteMissionController::class, 'info']);
            // 任务列表
            Route::get('/list', [SiteMissionController::class, 'index']);
        });

        /**
         * 任务模板
         */
        Route::group(["prefix" => "missionTemplate"], function () {
            Route::get('/lists', [MissionTemplateController::class, 'lists']);
            Route::get('/detail/{id}', [MissionTemplateController::class, 'detail']);
            Route::post('/edit/{id}', [MissionTemplateController::class, 'edit']);
        });

        Route::get('orderLog/index', 'OrderLogController@index');
        Route::get('notice/index', 'NoticeController@index');
        Route::post('notice/read', 'NoticeController@read');
        //发送签约短信
        Route::post('sendSms/signing', 'SendSmsController@signing');
        /**
         * 开店组织管理
         */
        Route::group(["prefix" => "organization"], function () {
            // 战区管理
            Route::prefix("warZone")->group(function () {
                Route::get('/', [WarZoneController::class, 'index']);
                Route::put('/{id}', [WarZoneController::class, 'update'])->where('id', '[0-9]+');;
                Route::get('/{id}', [WarZoneController::class, 'detail'])->where('id', '[0-9]+');;
            });


            Route::get('/lists', [OrganizationManageController::class, 'list']);
            Route::get('/info/{manageId}', [OrganizationManageController::class, 'getOrganizationInfoById']);
            Route::put('/', [OrganizationManageController::class, 'updateOrganizationById']);

            Route::get('/areaAdvisor/{manageId}', [OrganizationManageController::class, 'getAreaAdvisor']);
            Route::post('/areaAdvisor/{manageId}', [OrganizationManageController::class, 'setAreaAdvisor']);
            Route::post('/checkManagerShop', [OrganizationManageController::class, 'checkManagerShop']);// 督导关联门店检验
        });

        Route::group(['prefix' => 'rmsUser'], function () {
            Route::get('/list', [RmsUserController::class, 'getWebUserList']);
        });

        /**
         * 空间设计阶段
         */
        Route::group(["prefix" => "spaceDesign"], function () {
            Route::put('/confirm/{orderNo}', [SpaceDesignController::class, 'preparationConfirmation']);//筹备确认
            Route::post('/assignSpaceDesign', [SpaceDesignController::class, 'assignSpaceDesign']);//指派空间设计师
            Route::post('/uploadDesignImg', [SpaceDesignController::class, 'uploadDesignMappingData']);//上传设计图
            Route::put('/setDesignImg/{orderNo}',
                [SpaceDesignController::class, 'setDesignMappingDataWithOutPower']);//修改设计图
            Route::put('/setDesignImgWithPower/{orderNo}',
                [SpaceDesignController::class, 'setDesignMappingDataWithPower']);//修改设计图，带有权限
            Route::post('/confirmSpaceDesign', [SpaceDesignController::class, 'confirmSpaceDesign']);//设计师确认设计模块
            Route::get('/addCostOrder', [SpaceDesignController::class, 'addCostOrderForm']);//获取添加设计模块订单表单数据
            Route::post('/addCostOrder', [SpaceDesignController::class, 'addCostOrder']);//添加设计模块订单
            Route::post('/addSoftOrder', [SpaceDesignController::class, 'addSoftOrder']);//添加软装订单
            Route::get('/costOrderInfo/{preparationNo}', [SpaceDesignController::class, 'costOrderInfo']);//设计订单详情
            Route::get('/softOrderInfo/{preparationNo}', [SpaceDesignController::class, 'softOrderInfo']);//软装订单详情
            Route::put('/closeCostOrder/{preparationNo}', [SpaceDesignController::class, 'closeCostOrder']);//关闭设计订单
            Route::put('/closeSoftOrder/{preparationNo}', [SpaceDesignController::class, 'closeSoftOrder']);//关闭软装订单
            Route::put('/completeCostOrder/{preparationNo}',
                [SpaceDesignController::class, 'completeCostOrder']);//完成设计订单
            Route::put('/completeSoftOrder/{preparationNo}',
                [SpaceDesignController::class, 'completeSoftOrder']);//完成软装订单
            Route::post('/refundPreparationOrder', [SpaceDesignController::class, 'refundPreparationOrder']);//订单退款
            Route::post('/softFitSendOut', [SpaceDesignController::class, 'softFitSendOut']);//软装发货 - 旧版功能已废弃
            Route::get('/softSendList/{preparationNo}', [SpaceDesignController::class, 'getSoftSendList']);//软装发货-列表
            Route::delete('/softSendInfo/{sendNo}', [SpaceDesignController::class, 'deleteSoftSendInfo']);//软装发货-删除订单
            Route::get('/expressList', [SpaceDesignController::class, 'getExpressList']);//物流列表
            Route::post('/skipStep/{orderNo}', [SpaceDesignController::class, 'skipStep']); // 跳步骤
            Route::post('/closeEquipmentOrder', [SpaceDesignController::class, 'closeEquipmentOrder']); // 关闭设备订单
        });

        /**
         * 营建
         */
        Route::group(["prefix" => "engineeringConstruction"], function () {
            Route::post("/start/{orderNo}",
                [ShopEngineeringConstructionController::class, "engineeringConstructionStart"]);
            Route::post("/finish/{orderNo}",
                [ShopEngineeringConstructionController::class, "engineeringConstructionFinish"]);
            Route::get("/startDetail/{orderNo}", [ShopEngineeringConstructionController::class, "startDetail"]);
            Route::get("/finishDetail/{orderNo}", [ShopEngineeringConstructionController::class, "finishDetail"]);
            Route::put("/finish/{orderNo}", [ShopEngineeringConstructionController::class, "update"]);
        });

        /**
         * 验收
         */
        Route::group(["prefix" => "checkConfirm"], function () {
            Route::post("/assignManager/{orderNo}", [ShopCheckAcceptController::class, "assignManager"]);
            Route::get("/assignManagerDetail/{orderNo}", [ShopCheckAcceptController::class, "assignManagerDetail"]);
            Route::post("/managerConfirmSubmit/{orderNo}", [ShopCheckAcceptController::class, "managerConfirmSubmit"]);
            Route::get("/managerConfirmSubmitDetail/{orderNo}",
                [ShopCheckAcceptController::class, "managerConfirmSubmitDetail"]);
            Route::get("/formContent/{orderNo}", [ShopCheckAcceptController::class, "formContent"]);
            Route::put("/managerConfirmSubmit/{orderNo}", [ShopCheckAcceptController::class, "update"]);
        });

        /**
         * 开业
         */
        Route::group(["prefix" => "startBusiness"], function () {
            Route::post("/{orderNo}", [StartBusinessController::class, "submit"]);
            Route::put("/{orderNo}", [StartBusinessController::class, "update"]);
            Route::get("/{orderNo}", [StartBusinessController::class, "detail"]);
        });

        /**
         * 系统
         */
        Route::group(['prefix' => 'system'], function () {

            /**
             * 老公告系统 待废弃
             */
            //公告列表
            Route::get('notice/list', [SystemNoticeController::class, 'index']);
            //公告完成商家统计
            Route::get('notice/finish', [SystemNoticeController::class, 'finish']);
            //删除公告
            Route::post('notice/del', [SystemNoticeController::class, 'del']);
            //获得公告详情
            Route::get('notice/detail/{id}', [SystemNoticeController::class, 'detail']);
            //添加编辑公告
            Route::post('notice/save', [SystemNoticeController::class, 'save']);

            // 系统消息中心参数含义列表
            Route::get('notify/configTemp', [SystemNotifyController::class, 'configTemp']);
            // 系统消息中心列表
            Route::get('notify/list', [SystemNotifyController::class, 'index']);
            // 系统消息中心新增
            Route::post('notify/save', [SystemNotifyController::class, 'save']);
            // 系统消息推送
            Route::post('notify/push', [SystemNotifyController::class, 'push']);
            // 系统消息预推送
            Route::post('notify/prePush', [SystemNotifyController::class, 'prePush']);
            // 系统消息关闭
            Route::post('notify/close', [SystemNotifyController::class, 'close']);
            // 消息日志
            Route::get('notify/log', [SystemNotifyController::class, 'getLog']);
            // 效果统计
            Route::get('notify/statistical', [SystemNotifyController::class, 'statistical']);
            // 系统消息延时推送
            Route::post('notify/delayPush', [SystemNotifyController::class, 'delayPush']);
            // 系统消息延时推送取消
            Route::post('notify/cancelDelayPush', [SystemNotifyController::class, 'cancelDelayPush']);
        });

        /**
         * 设计师确认设备模块
         */
        Route::group(['prefix' => 'designerEquipment'], function () {
            Route::get('index/{orderNo}', [DesignerEquipmentController::class, 'index']);
            Route::get('detail/{orderNo}', [DesignerEquipmentController::class, 'detail']);
            Route::post('detail/save', [DesignerEquipmentController::class, 'save']);
            Route::post('deliveryNoteLogistics', [DesignerEquipmentController::class, 'deliveryNoteLogistics']);
            //新建订单准备数据 && 订单编辑页面
            Route::get('orderDetail', [DesignerEquipmentController::class, 'orderDetail']);
            //新建&修改订单
            Route::post('saveOrmOrder', [DesignerEquipmentController::class, 'saveOrmOrder']);
        });

        /**
         * 订货系统相关
         */
        Route::group(['prefix' => 'kfos'], function () {
            Route::get('firstOrder/{orderNo}', [KfosController::class, 'firstDeliveryNotes']); // 首批订货订单列表
            Route::post('deliveryNoteReceived', [KfosController::class, 'deliveryNoteReceived']); // 确认收货
            Route::get('deliveryNoteDetail', [KfosController::class, 'deliveryNoteDetail']); // 出库单详情

        });

        // 工服
        Route::group(['prefix' => 'workClothes'], function () {
            Route::get('lists', [KfosController::class, 'workClothesLists']); // 工服列表
            Route::post('create', [KfosController::class, 'createWorkClothes']); // 新增工服订单
            Route::post('close', [KfosController::class, 'closeWorkClothes']); // 关闭工服订单
            Route::post('writeOff', [KfosController::class, 'writeOff']); // 核销
        });

        //房源分公司列表
        Route::get('clueClassify', [SiteFormController::class, 'clueClassifyCache']);

        Route::get("/feishuUserDepartmentList", [SignOrderController::class, "feishuUserDepartmentList"]);//飞书用户部门列表
    });

    /**
     * 开店飞书小程序认证路由组
     */
    Route::middleware([AppletAuth::class])->group(function () {
        /**
         * 公共部分
         */
        Route::group(["prefix" => "site"], function () {
            Route::post("privateUpload", [CommonController::class, "privateUpload"]);
        });

        Route::get('shop/cityShop', [ShopController::class, 'cityShop']);

        /*
         * 获取商家登录的JWT
         */
        Route::post('getMerchantLoginJwt', [AppController::class, 'getMerchantLoginJwt']);

        /**
         * 选址表单提交
         */
        Route::prefix('siteLocation')->group(function () {
            //我的
            Route::get('/personal', [SiteFormController::class, 'personal']);
            Route::get('/siftList', [SiteFormController::class, 'siftList']);
            Route::get('/nearbyTakeOut', [SiteFormController::class, 'nearbyTakeOut']);
            Route::post('/preserveHeatMap', [SiteFormController::class, 'preserveHeatMap']);

            Route::get('/formNumberCount', [SiteFormController::class, 'countFormStatusNumber']);
            Route::get('/siteSurveyInfo', [SiteFormController::class, 'getSiteSurveyInfo']);
            Route::get('/siteSurveyList', [SiteFormController::class, 'getSiteSurveyList']);
            // 选址审批
            Route::post('audit', [SiteFormController::class, 'audit']);
            // 合同驳回
            Route::post('leaseReject/{id}', [SiteFormController::class, 'leaseReject'])->where('id', '[0-9]+');
            // 合同通过
            Route::post('leasePass/{id}', [SiteFormController::class, 'leasePass'])->where('id', '[0-9]+');

            // 热力图
            Route::get('heatMap', [SiteFormController::class, 'heatMap']);

            //复盘
            Route::post('replay', [SiteFormController::class, 'replay']);

            // 预选址
            Route::group(['prefix' => 'placeholder'], function () {
                Route::get('info/{orderNo}', [PlaceholderController::class, 'getInfo']);
                Route::put('info/{orderNo}', [PlaceholderController::class, 'save']);
                Route::post('audit/{orderNo}', [PlaceholderController::class, 'audit']);
            });

            Route::get('/info/{id}', [SiteFormController::class, 'getSiteForm']);
            //租赁合同表单
            Route::get('/leaseContractInfo/{id}', [SiteFormController::class, 'getLeaseContractForm']);
            Route::put('/info/{id}', [SiteFormController::class, 'setSiteForm']);
            Route::put('/customerAnalysis/{id}', [SiteFormController::class, 'setCustomerAnalysis']);
            Route::put('/productAnalysis/{id}', [SiteFormController::class, 'setProductAnalysis']);
            Route::put('/checkFormRequired/{id}', [SiteFormController::class, 'checkFormRequired']);
            //租赁合同提交
            Route::post('/leaseContractSubmit/{id}', [SiteFormController::class, 'leaseContractSubmit']);
            Route::delete('/productAnalysis/{id}', [SiteFormController::class, 'delProductAnalysis']);
            //房源线索添加
            Route::post('clue', [SiteFormController::class, 'clueSiteLocationInsert']);//房源线索添加
            Route::post('updateClueBasisInfo/{orderNo}', [SiteFormController::class, 'updateClueBasisInfo']);//修改房源基本信息
            Route::get('clue/{id}', [SiteFormController::class, 'clueSiteLocationDetail']);//房源线索详情
            Route::get('allClue/{id}', [SiteFormController::class, 'allClueDetail']);//所有房源房源线索
            Route::put('assignManager/{id}', [SiteFormController::class, 'assignManager']);//指派开发顾问
            Route::get('managerList', [SiteFormController::class, 'managerList']);//开发顾问列表
            Route::put('clueUpDown/{id}', [SiteFormController::class, 'clueUpDown']);//房源上下架
            Route::put('clueInvalid/{id}', [SiteFormController::class, 'clueInvalid'])
                 ->where('id', '[0-9]+');//房源线索失效

            //房源统计头
            Route::get('houseResourcesCount', [SiteFormController::class, 'houseResourcesCount']);
            //房源列表
            Route::get('houseResourcesList', [SiteFormController::class, 'houseResourcesList']);
            //房源分公司列表
            Route::get('clueClassify', [SiteFormController::class, 'clueClassify']);
            //确认房源列表
            Route::post('choosesClue', [SiteFormController::class, 'choosesClue']);

            //添加房源搜索商场
            Route::get('searchMall', [SiteFormController::class, 'searchMall']);

            //添加房源搜索街道
            Route::get('searchStreet', [SiteFormController::class, 'searchStreet']);

            //新增房源转让操作
            Route::post('transferHouse/{id}', [SiteFormController::class, 'transferHouse'])->where('id', '[0-9]+');


            //通过经纬度获得城市&等级&附近门店&距离
            Route::get('baseHouseInfoByLatAndLng', [SiteFormController::class, 'baseHouseInfoByLatAndLng']);
            //房源搜索筛选项
            Route::get('houseSearchSift', [SiteFormController::class, 'houseSearchSift']);

            //修改评估报告
            Route::post('report/update', [SiteEvaluateInputController::class, 'reportUpdate']);

            Route::group(['prefix' => 'evaluate'], function () {
                Route::get('inputs/info', [SiteEvaluateInputController::class, 'info']);
                Route::post('inputs/update', [SiteEvaluateInputController::class, 'update']);
                Route::post('inputs/submit', [SiteEvaluateInputController::class, 'submit']);
                Route::get('inputs/auditForm', [SiteEvaluateInputController::class, 'auditForm']);
                Route::post('inputs/audit', [SiteEvaluateInputController::class, 'audit']);
                Route::get('inputs/result', [SiteEvaluateInputController::class, 'result']);
            });

            /**
             * 重新选址
             */
            Route::post('/reSelection/{orderNo}', [SiteFormController::class, 'businessRejectRestoreStep']);

            /**
             * 选址网规地图
             */
            Route::get("mapLists", [SelectionController::class, "mapLists"]);//全国视图列表
            Route::get("mapRank", [SelectionController::class, "mapRank"]);//全国视图排行榜
            Route::get("mapRange", [SelectionController::class, "mapRange"]);//全国省市区范围经纬度
            Route::get("mapShopList", [SelectionController::class, "mapShopList"]);//区域内店铺-列表
            Route::get("mapDetail/{shopId}", [SelectionController::class, "mapDetail"])
                 ->where('shopId', '[0-9]+');//单个店铺点位详细
            Route::get("mapDataList", [SelectionController::class, "mapDataList"]);//城市内数据集列表
            Route::get("mapRecommend", [SelectionController::class, "mapRecommend"]);//通过城市查询推荐区域
            //省市区中心点
            Route::get("mapCenterPoint", [SelectionController::class, "mapCenterPoint"]);//省市中心点


            //楼层导览
            Route::get('floorGuide', [SelectionController::class, 'floorGuide']);

            //外卖预估
            Route::get('takeawayEstimate', [SelectionController::class, 'takeawayEstimate']);

            //通过经纬度获得手绘图底图
            Route::get('drawnBaseMapImg', [SelectionController::class, 'drawnBaseMapImg']);

            //品牌树
            Route::get('brandTree', [SelectionController::class, 'brandTree']);

            //通过mallId和floor获得所属楼层
            Route::get('getStoreByMallIdAndFloor', [SelectionController::class, 'getStoreByMallIdAndFloor']);
            //通过mallId获得推荐楼层店铺
            Route::get('getRecommendFloorStoreByMallId', [SelectionController::class, 'getRecommendFloorStoreByMallId']);

            //手绘动线上传
            Route::post('uploadHandDrawImg/{id}', [SelectionController::class, 'uploadHandDrawImg']);

            //根据城市code获得商圈边界
            Route::get('getBusinessBoundaryByCityCode', [SelectionController::class, 'getBusinessBoundaryByCityCode']);


            // 大客户部门 big customer department
            Route::prefix('bcd')->group(function () {
                // 堪址清单
                Route::get('site/list', [CustomerDepartmentController::class, 'site']);
                // 任务详情
                Route::get('site/{id}', [CustomerDepartmentController::class, 'detailSite'])->where('id', '[0-9]+');
                // 收藏任务
                Route::post('site/collect/{id}', [CustomerDepartmentController::class, 'collectTask'])->where('id', '[0-9]+');

                // 新增线索
                Route::post('clue/add', [CustomerDepartmentController::class, 'addClue']);
                // 线索列表
                Route::get('clue/list', [CustomerDepartmentController::class, 'clue']);
                // 线索详情
                Route::get('clue/{id}', [CustomerDepartmentController::class, 'detailClue'])->where('id', '[0-9]+');

                // 新增客户信息
                Route::post('dock/add', [CustomerDepartmentController::class, 'addDock']);
                // 客户列表
                Route::get('dock/list', [CustomerDepartmentController::class, 'dock']);
                // 客户详情
                Route::get('dock/{id}', [CustomerDepartmentController::class, 'detailDock'])->where('id', '[0-9]+');

                // 新增跟进记录
                Route::post('followUp/add', [CustomerDepartmentController::class, 'addFollowUp']);
                // 跟进记录列表
                Route::get('followUp/list', [CustomerDepartmentController::class, 'followUp']);
                // 跟进记录详情
                Route::get('followUp/{id}', [CustomerDepartmentController::class, 'detailFollowUp'])->where('id', '[0-9]+');


            });


            Route::prefix('intendedSiteSelection')->group(function () {
                // 开发经理提交跟进记录
                Route::post('/submitRecord/{id}', [IntendedSiteSelectionController::class, 'submitRecord'])->where('id', '[0-9]+');
                // 开发经理跟进意向记录
                Route::get('/record', [IntendedSiteSelectionController::class, 'record']);
            });

        });

        /**
         * 网规
         */
        Route::prefix('programming')->middleware(WangGuiCityByPower::class)->group(function () {
            //根据权限去匹配城市列表
            Route::get('cityListByPower', [ProgrammingController::class, "cityListByPower"]);
            //根据经纬度去匹配城市
            Route::get('getCityByLatLng', [ProgrammingController::class, "getCityByLatLng"]);
            //筛选条件
            Route::get('sift', [ProgrammingController::class, "sift"]);
            //热门城市搜索
            Route::get('hotCity', [ProgrammingController::class, "hotCity"]);
            //网规页面列表筛选
            Route::get('list', [ProgrammingController::class, "list"]);
            //详情展示
            Route::get('detail', [ProgrammingController::class, "detail"]);
            //网规容量渗透率
            Route::get('capacity', [ProgrammingController::class, "capacity"]);

            //获得一个城市的对应网规点位
            Route::get('getWgDotByCity', [ProgrammingController::class, "getWgDotByCity"]);
            //获取点位300米内的信息
            Route::get('dotNearbyInfo', [ProgrammingController::class, "getNearbyDot"]);

            //点位评估
            Route::post('dotEvaluate', [ProgrammingController::class, "dotEvaluate"]);
            Route::get('evaluateDetail', [ProgrammingController::class, "evaluateDetail"]);

            /**
             * 我的
             */
            //浏览记录
            Route::get('browsingHistory', [ProgrammingController::class, "browsingHistory"]);
            //评估记录
            Route::get('evaluateHistory', [ProgrammingController::class, "evaluateHistory"]);
        });


        /**
         * 沙盘
         */
        Route::prefix('sandTable')->middleware(WangGuiCityByPower::class)->group(function () {
            Route::get('getCityByLngAndLat',
                [\App\Http\Controllers\OpenShop\FeishuMini\CommonController::class, "getCityByLngAndLat"]);  //根据经纬度获得城市
            Route::get('sift', [SandTableController::class, "sift"]);                                       //筛选条件
            Route::get('getProgrammingDotByCitySearch', [SandTableController::class, "getProgrammingDotByCitySearch"]); //获得市下面所有的网规点位信息数字筛选
            Route::get('getProgrammingDotByCity', [SandTableController::class, "getProgrammingDotByCity"]); //获得市下面所有的网规点位信息  弃用
            Route::get('getDotDetail', [SandTableController::class, "getDotDetail"]);                       //获取点位详情
            Route::get('getDotCardInfo', [SandTableController::class, "getDotCardInfo"]);                   //获取点位卡片
            Route::get('dotSearch', [SandTableController::class, "dotSearch"]);                             //搜索点位
            Route::get('getKfDotPolymerize', [SandTableController::class, "getKfDotPolymerize"]);           //获得夸父品牌点位聚合信息
        });
        Route::get('sandTable/getCenterDotByCity', [SandTableController::class, "getCenterDotByCity"]);     //获得中心点位
        Route::get('sandTable/getBoundaryByCity',
            [SandTableController::class, "getBoundaryByCity"]);       //根据城市获得区域下的边界

        Route::prefix('user')->group(function () {
            Route::get('info/', [UserController::class, 'getRmsUserInfo']);
        });

        // 查询门店属性配置项
        Route::get('getShopAttributeData', [CommonController::class, 'getShopAttributeData']);
    });

    Route::get('weather', [WeatherController::class, 'getWeatherHoliday']);
    Route::get('getAreaCodeByArea',
        [\App\Http\Controllers\OpenShop\SiteLocation\AreaController::class, 'getAreaCodeByArea']);
    Route::get('getCityGradeByCityCode',
        [\App\Http\Controllers\OpenShop\SiteLocation\AreaController::class, 'getCityGradeByCityCode']);
});

// 商家APP
Route::prefix('merchant')->middleware(MerchantAppAuth::class)->group(function () {

    // 开店配置接口
    Route::prefix('config')->group(function () {
        Route::get('/', [\App\Http\Controllers\OpenShop\Merchant\ConfigController::class, 'configInfo']);
    });

    // 开店订单
    Route::prefix('order')->group(function () {

        // 开店进度
        Route::get('progress', [MerchantOrderController::class, 'progress']);

        // 合同资料
        Route::get('contract', [MerchantOrderController::class, 'contract']);

        // 订单详情
        Route::get('detail', [MerchantOrderController::class, 'detail']);

        //支付记录
        Route::get('payHistory', [MerchantOrderController::class, 'orderPayHistory']);

        // 用户的待支付订单列表
        Route::get('unpaidList', [MerchantOrderController::class, 'unpaidList']);

        // 设计模块支付详情
        Route::get('payDesignDetail', [MerchantOrderController::class, 'payDesignDetail'])
             ->withoutMiddleware(MerchantAppAuth::class);

        Route::get('/softSendList/{orderNo}', [SpaceDesignController::class, 'getSoftSendListByOrderNo']);//软装发货-列表

        // 软装模块支付详情
        Route::get('payDecorateDetail', [MerchantOrderController::class, 'payDecorateDetail'])
             ->withoutMiddleware(MerchantAppAuth::class);
    });
    Route::get('expressUrl', [ExpressController::class, 'express']);

    Route::prefix('notice')->group(function () {
        //公告展示
        Route::get('index', [\App\Http\Controllers\OpenShop\Merchant\SystemNoticeController::class, 'index']);
        //公告确认
        Route::get('read', [\App\Http\Controllers\OpenShop\Merchant\SystemNoticeController::class, 'read']);
    });

    Route::prefix('notify')->group(function () {
        // 获取消息弹窗
        Route::get('popInfo', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'popInfo']);
        // 获取消息弹窗列表 ⚠️ 已废弃
        Route::get('popList', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'popList']);
        // 消息中心列表数据
        Route::get('firstList', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'firstList']);
        Route::get('secondList', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'secondList']);
        Route::get('unreadNum',
            [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'getUnreadNum']);
        // 公告详情
        Route::get('info', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'info']);
        // 公告已读
        Route::post('read', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'read']);
        // 公告消息完全读完
        Route::post('readAll', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'readAll']);
        //消息中心消息看板
        Route::get('taskBoard', [\App\Http\Controllers\OpenShop\Merchant\SystemNotifyController::class, 'getTaskBoard']);
    });
    /**
     * 任务模块
     */
    Route::prefix('mission')->group(function () {
        // 任务列表
        Route::get('list', [\App\Http\Controllers\OpenShop\Merchant\SiteMissionController::class, 'missionList']);
        //确认选址信息
        Route::post('confirmShopLocation',
            [\App\Http\Controllers\OpenShop\Merchant\SiteMissionController::class, 'confirmShopLocation']);
        //选址详细信息
        Route::get('shopLocationDetail',
            [\App\Http\Controllers\OpenShop\Merchant\SiteMissionController::class, 'shopLocationDetail']);
        //驳回选址信息
        Route::post('rejectShopLocation',
            [\App\Http\Controllers\OpenShop\Merchant\SiteMissionController::class, 'rejectShopLocation']);
    });

    Route::prefix('logistics')->group(function () {
        Route::get('index', [\App\Http\Controllers\OpenShop\Merchant\LogisticsController::class, 'index']);
    });
    //房源分公司列表
    Route::get('clueClassify', [SiteFormController::class, 'clueClassify']);

    /**
     * 商家APP-记账本
     */
    Route::prefix('cashbook')->group(
        function () {
            Route::get('total', [CashbookController::class, 'total']);//总览
            Route::get('list', [CashbookController::class, 'list']);//列表
            Route::post('add', [CashbookController::class, 'add']);//新增
            Route::get('detail/{id}', [CashbookController::class, 'detail'])->where('id', '[0-9]+');//详情
            Route::post('update/{id}', [CashbookController::class, 'update'])->where('id', '[0-9]+');//修改
            Route::delete('delete/{id}', [CashbookController::class, 'delete'])->where('id', '[0-9]+');//删除
            Route::get('switch', [CashbookController::class, 'switchList']);//同步开关列表
            Route::post('switch', [CashbookController::class, 'switchUpdate']);//同步开关编辑
            Route::get('cycle', [CashbookController::class, 'cycleList']);//周期记录列表
            Route::get('cycle/{id}', [CashbookController::class, 'cycleDetail'])->where('id', '[0-9]+');//周期记录详情
            Route::delete('cycle/{id}', [CashbookController::class, 'cycleDelete'])->where('id', '[0-9]+');//周期记录删除
            Route::post('cycle', [CashbookController::class, 'cycleUpdate']);//周期记录编辑
            Route::put('manualUpdate', [CashbookController::class, 'manualUpdate']);//记账本数据手动同步
        }
    );

    /**
     * 排班
     */
    Route::prefix('schedule')->group(function () {

        // 排班
        Route::prefix('handle')
             ->middleware(MerchantManager::class)
             ->middleware([
                 LockBefore::class . ":" . LockBefore::LOCK_TYPE_TOTAL_REQUEST,
                 LockAfter::class . ':' . LockBefore::LOCK_TYPE_TOTAL_REQUEST
             ])
             ->group(function () {

                 // 单次
                 Route::post('single', [ScheduleHandleController::class, 'single']);

                 // 组合
                 Route::post('combine', [ScheduleHandleController::class, 'combine']);

                 // 周期
                 Route::post('cycle', [ScheduleHandleController::class, 'cycle']);

                 // 删除
                 Route::post('del', [ScheduleHandleController::class, 'del']);
             });

        // 班次管理
        Route::prefix('rules')->group(function () {
            Route::get('list', [ScheduleController::class, 'rulesList']);//班次管理-列表
            Route::post('update', [ScheduleController::class, 'rulesUpdate'])
                 ->middleware(MerchantManager::class);//班次管理-新增/修改
            Route::delete('delete/{id}', [ScheduleController::class, 'rulesDelete'])->where('id', '[0-9]+')
                 ->middleware(MerchantManager::class);//班次管理-删除
            Route::get('remindSwitch', [ScheduleController::class, 'remindSwitch']);//班次管理-提醒开关
            Route::post('remindSwitch', [ScheduleController::class, 'remindSwitchUpdate']);//班次管理-提醒开关修改
            Route::get('usersTotal', [ScheduleController::class, 'usersTotal']);//班次管理-班次统计
            Route::get('preview', [ScheduleController::class, 'preview']);//员工排班预览
        });

        // 店长排班预览
        Route::get('scheduleOverviewManager', [ScheduleController::class, 'scheduleOverviewManager'])
             ->middleware(MerchantManager::class);

        // 排班入口
        Route::get('scheduleOverview', [ScheduleController::class, 'scheduleEntrance'])
             ->middleware(MerchantManager::class);

        // 员工列表
        Route::get('scheduleStaff', [ScheduleController::class, 'scheduleStaff']);
    });

    // 续签
    Route::prefix('renew')->group(function () {

        // 续签办理
        Route::prefix('inputs')->group(function () {

            // 详情页查询
            Route::get('/info', [\App\Http\Controllers\OpenShop\Merchant\RenewController::class, 'inputInfo']);

            // 加盟商修改表单内容
            Route::post('/update', [\App\Http\Controllers\OpenShop\Merchant\RenewController::class, 'inputUpdate']);

            // 加盟商提交
            Route::post('/submit', [\App\Http\Controllers\OpenShop\Merchant\RenewController::class, 'inputSubmit']);
        });

        Route::post("/contractNotice", [UserContractController::class, "contractNotice"]);//续签合同催签
    });

    // 加盟商自带址申请
    Route::prefix("intendedSiteSelection")->group(function(){
        //列表
        Route::get("/", [IntendedSiteSelectionController::class, "list"]);
        //新增
        Route::post("/", [IntendedSiteSelectionController::class, "insert"]);
        //删除
        Route::post("del", [IntendedSiteSelectionController::class, "del"]);
        //详情
        Route::get("/{id}", [IntendedSiteSelectionController::class, "detail"])->where('id', '[0-9]+');
        // 意向区域
        Route::get("/intendedCity", [IntendedSiteSelectionController::class, 'intendedCity']);
        // 获得点位信息
        Route::get("/dotInfoByLatAndLng", [IntendedSiteSelectionController::class, 'dotInfoByLatAndLng']);
        // 获得网规点位信息
        Route::get("/wangguiInfoByLatAndLng", [IntendedSiteSelectionController::class, 'wangguiInfoByLatAndLng']);

        //分公司列表
        Route::get("/subCompany", [IntendedSiteSelectionController::class, 'subCompany']);

        // 获得点位列表
        Route::get("/pointInfoByLatAndLng", [IntendedSiteSelectionController::class, 'pointInfoByLatAndLng']);
        // 收藏点位/取消收藏
        Route::post("/collection", [IntendedSiteSelectionController::class, 'collection']);
        // 开发经理列表
        Route::get('/managerList', [SiteFormController::class, 'managerList']);//开发顾问列表
        // 指派开发经理
        Route::post('/assignManager/{id}', [IntendedSiteSelectionController::class, 'assignManager'])->where('id', '[0-9]+');
    });

});

Route::prefix('contract')->group(function () {
    Route::post('signing', [UserContractController::class, 'contractSigningNotify']);
    Route::post('signingV2', [UserContractController::class, 'contractSigningNotifyV2']);
    Route::post('signNotify', [UserContractController::class, 'commonSignNotify']);
});

Route::prefix('applet')->group(function () {
    Route::prefix('feishu')->group(function () {
        Route::post('login', [AppletLoginController::class, 'login']);
    });
});

Route::middleware([AppletAuth::class])->prefix('feishuMini')->group(function () {

    /**
     * 夸父开店小程序
     */
    Route::prefix('open')->group(function () {

        // 首页
        Route::get('index', [IndexController::class, 'index']);

        // 任务
        Route::prefix('siteMission')->group(function () {
            Route::get('lists', [MissionController::class, 'lists']); // 任务列表
            Route::get('listsCount', [MissionController::class, 'listsCount']); // 任务列表顶部数字
            Route::get('baseInfo/{id}', [MissionController::class, 'baseInfo']); // 任务详情顶部基础信息

            //筹备部确认建店信息 任务详情 + 提交
            Route::get('buildInfo', [MissionController::class, 'buildInfo']);
            Route::post('preparationConfirm', [MissionController::class, 'preparationConfirm']);
            //筹备部确认施工进场；任务详情+提交
            Route::get('constructionInfo', [MissionController::class, 'constructionInfo']);
            Route::post('constructionStart', [MissionController::class, 'constructionStart']);

            //筹备部确认施工完成；任务详情+提交
            Route::get('constructionInput', [MissionController::class, 'constructionInput']);
            Route::post('constructionUpdate', [MissionController::class, 'constructionUpdate']);
            Route::post('constructionFinish', [MissionController::class, 'constructionFinish']);
        });

        // 选址
        Route::prefix('selection')->group(function () {
            Route::get('/manager/list', [SelectionController::class, 'index']);
            Route::post('/manager/add', [SelectionController::class, 'addManager']);
            Route::get('/manager/detail/{orderNo}', [SelectionController::class, 'managerDetail']);
        });

        // 验收
        Route::group(["prefix" => "checkConfirm"], function () {
            Route::get("/formContent/{orderNo}", [ShopCheckAcceptController::class, "formContent"]);
            Route::post("/managerConfirmSubmit/{orderNo}", [ShopCheckAcceptController::class, "managerConfirmSubmit"]);
            Route::get("/managerConfirmSubmitDetail/{orderNo}",
                [ShopCheckAcceptController::class, "managerConfirmSubmitDetail"]);
            Route::post("/assignManager/{orderNo}", [ShopCheckAcceptController::class, "assignManager"]);
        });

        // 开业
        Route::group(["prefix" => "startBusiness"], function () {
            Route::post("/{orderNo}", [StartBusinessController::class, "submitPart"]); // 提交开业报告
            Route::get("/{orderNo}", [StartBusinessController::class, "detailInput"]); // 开业报告待提交详情，input
        });

        // 门店
        Route::prefix('shop')->group(function () {
            Route::get('overview', [ShopController::class, 'overview']);
            Route::get('lists', [ShopController::class, 'lists']);

            Route::get('progress', [ShopController::class, 'progress']);      //流程进度
            Route::get('detail', [ShopController::class, 'detail']);          //门店详情
            Route::get('logistics', [ShopController::class, 'logistics']);    //门店订单详情
        });

        //服务顾问
        Route::prefix('consultants')->group(function () {
            //顾问列表
            Route::get('lists', [ConsultantsController::class, 'lists']);
            //更换
            Route::post('replace', [ConsultantsController::class, 'replace']);
        });

        // 续签
        Route::prefix('renew')->group(function () {

            // 续签办理
            Route::prefix('inputs')->group(function () {

                // 详情页查询
                Route::get('info', [\App\Http\Controllers\OpenShop\FeishuMini\RenewController::class, 'info']);

                // 可驳回节点列表
                Route::get('rejectNodeLists',
                    [\App\Http\Controllers\OpenShop\FeishuMini\RenewController::class, 'rejectNodeLists']);

                // 审批
                Route::post('audit', [\App\Http\Controllers\OpenShop\FeishuMini\RenewController::class, 'audit']);
            });
        });

        // 临期门店
        Route::prefix('expireShop')->group(function () {
            //入口待处理工单消息提醒
            Route::get('/pendingRenewOrderMsg', [ExpireShopController::class, 'pendingRenewOrderMsg']);

            //续签工单列表
            Route::get('/renewWorkOrderList', [ExpireShopController::class, 'renewWorkOrderList']);

            //续签提醒 - 工作台头部统计
            Route::get('/renewWorkOrderGroup', [ExpireShopController::class, 'renewWorkOrderGroup']);
            //续签提醒 - 工作台底部门店列表
            Route::get('/renewWorkOrderGroupList', [ExpireShopController::class, 'renewWorkOrderGroupList']);

            //续签流程 - 工作台头部统计
            Route::get('/renewWorkOrderFlowGroup', [ExpireShopController::class, 'renewWorkOrderFlowGroup']);
            //续签流程 - 工作台底部门店列表
            Route::get('/renewWorkOrderFlowGroupList', [ExpireShopController::class, 'renewWorkOrderFlowGroupList']);
        });
    });
});

Route::prefix('message')->group(function () {

    Route::get('mission/info/{missionId}',
        [\App\Http\Controllers\OpenShop\Message\MessageController::class, 'missionInfoBoard']);

    // 飞书推送专用跳板url
    Route::get('boardUrl', [\App\Http\Controllers\OpenShop\Message\MessageController::class, 'boardUrl']);
});

Route::prefix('debug')->group(function () {

    // 修改设计费金额
    Route::post('saveDesignPrice/{orderNo}', [SpaceDesignController::class, 'saveDebugDesignPrice']);

    // 加盟费部分支付跳过
    Route::get('skipPartPay', [SignOrderController::class, 'skipPartPay'])->middleware(FeishuWebAuth::class)->middleware([
        LockBefore::class . ":" . LockBefore::LOCK_TYPE_TOTAL_REQUEST,
        LockAfter::class . ':' . LockBefore::LOCK_TYPE_TOTAL_REQUEST
    ]);

    // 门店阶段跳过
    Route::get('skipStep', [SignOrderController::class, 'skipStep'])->middleware([
        LockBefore::class . ":" . LockBefore::LOCK_TYPE_TOTAL_REQUEST.":30",
        LockAfter::class . ':' . LockBefore::LOCK_TYPE_TOTAL_REQUEST
    ]);
});

